<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport"
	      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<!--框架文件开始-->
	<!--    <script src="js/jquery.js"></script>-->
	<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
	<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
	<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css"
	      integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
	<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css"
	      integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"
	        integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
	        crossorigin="anonymous"></script>
	<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
	<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
	<!--	初始化css-->
	<link rel="stylesheet" href="./css/rest.css">
	<!--框架文件结束-->
	<title>登陆页面</title>
</head>
<style>
	/*头部开始*/
	#header {
	
	}
	
	/*头部结束*/
	/*中间开始*/
	#section {
	
	}
	
	#section .left {
	}
	
	#section .right {
	}
	
	form {
		width: 40%;
		height: 80px;
		margin: 10% auto;
	}
	
	/*中间结束*/
	/*脚部开始*/
	#footer {
	
	}
	
	/*脚部结束*/
</style>
<body>
<header id="header"></header>
<section id="section">
	<form>
		<div class="form-group">
			<label for="exampleInputEmail1">Account</label>
			<input type="text" class="form-control" id="exampleInputEmail1" placeholder="Email">
		</div>
		<div class="form-group">
			<label for="exampleInputPassword1">Password</label>
			<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
		</div>
		<button type="button" id="submit" class="btn btn-default">Submit</button>
	</form>
</section>
<footer id='footer'></footer>
</body>
<script>
	$(function () {
		$("form").on("submit", function (event) {
			event.preventDefault();
			//console.log($(this).serialize());
		});
		
		$('#submit').click(function () {
			var account = $('#exampleInputEmail1');
			var password = $('#exampleInputPassword1');
			account.attr('name', 'account');
			password.attr('name', 'password');
			$.ajax({
				url: '/admin.php/admin/login',
				data: $('form').serialize(),
				method: "POST",
				success: function (res) {
					if(res.code===0){
						alert(res.msg);
					}else{
						location.href='/admin/index.html';
					}
				}
			})
		})
	})
</script>
</html>